package org.iqiyi.util;

import org.iqiyi.entity.Auth;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;

public class UserUtil {
    public static Auth getUserData(){
        SecurityContext ctx = SecurityContextHolder.getContext();
        Authentication auth = ctx.getAuthentication();
        //token存在redis的获取当前用户
        Auth user = (Auth) auth.getPrincipal();
        return user;
    }
}
